class Solution(object):
    def maxPower(self, s):
        n = len(s)
        max_len = 0
        left = 0
        right = 0
        while right < n:
            if s[right] == s[left]:
                max_len = max(max_len, right - left + 1)
                right += 1
            else:
                left = right
        return max_len